<?php
/*
    Meta777 is Web-based AI Software.

    Copyright (C) 2013  White Rabbit

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
$itx['plug']['result'] = myquery("SELECT * FROM `".dbprfx."plugin` WHERE (`plugin-run-id` < '18446744073709551516') AND ((`plugin-run-id` = '18446744073709551515') or (`plugin-run-id` = '".$itx['get']['id']."')) AND `plugin-type` = 'pre' ORDER BY `plugin-list-order` ASC");
if ($itx['plug']['result'] != "not") {
	$itx['plug']['rows'] = myrows($itx['plug']['result']);
	$itx['plug']['counter'] = 0;
	while($itx['plug']['counter'] <= $itx['plug']['rows']) {
		$itx['plug']['array'] = myarray($itx['plug']['result']);
		if (file_exists(pathprivate."plugins/plg-".$itx['plug']['array']['plugin-name']."/pre.php")) {
			include(pathprivate."plugins/plg-".$itx['plug']['array']['plugin-name']."/pre.php");
		}
		$itx['plug']['counter']++;
	}
	$itx['plug']['counter'] = NULL;
}
$itx['plug']['result'] = myquery("SELECT * FROM `".dbprfx."plugin` WHERE (`plugin-run-id` < '18446744073709551516') AND ((`plugin-run-id` = '18446744073709551515') or (`plugin-run-id` = '".$itx['get']['id']."')) AND `plugin-type` = 'run' ORDER BY `plugin-list-order` ASC");
if ($itx['plug']['result'] != "not") {
	$itx['plug']['rows'] = myrows($itx['plug']['result']);
	$itx['plug']['counter'] = 0;
	while($itx['plug']['counter'] <= $itx['plug']['rows']) {
		$itx['plug']['array'] = myarray($itx['plug']['result']);
		if (file_exists(pathprivate."plugins/plg-".$itx['plug']['array']['plugin-name']."/run.php")) {
			include(pathprivate."plugins/plg-".$itx['plug']['array']['plugin-name']."/run.php");
		}
		$itx['plug']['counter']++;
	}
	$itx['plug']['counter'] = NULL;
}

$itx['plug']['result'] = myquery("SELECT * FROM `".dbprfx."plugin` WHERE (`plugin-run-id` < '18446744073709551516') AND ((`plugin-run-id` = '18446744073709551515') or (`plugin-run-id` = '".$itx['get']['id']."')) AND `plugin-type` = 'post' ORDER BY `plugin-list-order` ASC");
if ($itx['plug']['result'] != "not") {
	$itx['plug']['rows'] = myrows($itx['plug']['result']);
	$itx['plug']['counter'] = 0;
	while($itx['plug']['counter'] <= $itx['plug']['rows']) {
		$itx['plug']['array'] = myarray($itx['plug']['result']);
		if (file_exists(pathprivate."plugins/plg-".$itx['plug']['array']['plugin-name']."/post.php")) {
			include(pathprivate."plugins/plg-".$itx['plug']['array']['plugin-name']."/post.php");
		}
		$itx['plug']['counter']++;
	}
	$itx['plug']['counter'] = NULL;
}
?>
